package online.szlib.com.core.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

@Entity
@Table(name="users")
public class User implements Serializable {

	private static final long serialVersionUID = -723583058586873477L;
	
	public User(){}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "uid")
	private Long userId;
	
	@Column(name="utype")
	private String userType;
	
	@Column(name="usrc")
	private String userSrc;
	
	@Column(name="uname")
	private String userName;
	
	@Column(name="uemail", length = 256)
	private String userEmail;
	
	@Column(name="umob" , length = 32)
	private String userMobile;
	
	@Column(name="upwd", length = 256)
	private String password;
	
	@Column(name="ucardno", length = 64)
	private String cardNumber;
	
	@Column(name="startdate")
	@Temporal(TemporalType.DATE) 
	private Date startDate;
	
	@Column(name="enddate")
	@Temporal(TemporalType.DATE) 
	private Date endDate;
	
	@Column(name="ustatus")
	private String status;
	
	@Column(name="uaddress", length = 256)
	private String address;
	
	@Column(name="usex")
	private String sex;
	
	@Column(name="ubirth")
	private String birthDay;
	
	@Column(name="umemo")
	@Lob @Basic(fetch=FetchType.LAZY)
	private String memo;
	
	@Column(name="ujpg")
	@Lob @Basic(fetch=FetchType.LAZY)
	private byte[] userImage;
	
	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	public String getUserSrc() {
		return userSrc;
	}

	public void setUserSrc(String userSrc) {
		this.userSrc = userSrc;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public String getUserMobile() {
		return userMobile;
	}

	public void setUserMobile(String userMobile) {
		this.userMobile = userMobile;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getCardNumber() {
		return cardNumber;
	}

	public void setCardNumber(String cardNumber) {
		this.cardNumber = cardNumber;
	}

	
	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getBirthDay() {
		return birthDay;
	}

	public void setBirthDay(String birthDay) {
		this.birthDay = birthDay;
	}

	@Basic(fetch=FetchType.LAZY)
	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	@Basic(fetch=FetchType.LAZY)
	public byte[] getUserImage() {
		return userImage;
	}

	public void setUserImage(byte[] userImage) {
		this.userImage = userImage;
	}

	public String toString() {
        return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }
}
